package org.wu.framework.easy.markdown.endpoint.convert;


import org.wu.framework.easy.markdown.endpoint.EasyMarkDownPoint;
import org.wu.framework.easy.markdown.stereotype.markdown.EasyMarkDown;
import org.wu.framework.core.stereotype.converter.LayerAnnotationConverterAdapter;

/**
 * describe :
 *
 * @author : Jia wei Wu
 * @version 1.0
 * @date : 2023/1/2 19:23
 */
public class EasyMarkDownPointConvert implements LayerAnnotationConverterAdapter<EasyMarkDown, EasyMarkDownPoint> {

    /**
     * 是否支持
     *
     * @param annotation    注解
     * @param markDownPoint 断点
     * @return boolean
     */
    @Override
    public boolean supports(EasyMarkDown annotation, EasyMarkDownPoint markDownPoint) {
        return true;
    }

    /**
     * @param annotation 原始注解
     * @return 返回断点信息
     */
    @Override
    public EasyMarkDownPoint converter(EasyMarkDown annotation) {
        if (null == annotation) {
            return null;
        }
        String fileName = annotation.fileName();
        String suffix = annotation.suffix();
        EasyMarkDownPoint markDownPoint = new EasyMarkDownPoint();
        markDownPoint.setFileName(fileName);
        markDownPoint.setSuffix(suffix);
        return markDownPoint;
    }
}
